package com.bluejie.bluej.java.base.container;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class ListCopyDemo {

    private static ListCopyDemo listCopyDemo = new ListCopyDemo();
    public static void main(String[] args) {
        listCopyDemo.copy();
    }

    private void copy(){
        List from = new ArrayList();
        from.add("1");
        from.add("2");
        from.add("3");
        //size大小于实际存储数量不同
        List to  = new ArrayList(Arrays.asList(new Object[from.size()]));

        Collections.copy(to,from);
        System.out.println(to.size());
    }
}
